package com.ls.controller.booking;

import com.ls.controller.booking.model.*;
import com.ls.service.IBookingService;
import com.ls.utils.ResultData;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @ClassName BookingAppController
 * @Description app预定
 *
 * @author pengyu
 * @since 2024-06-28
 */
@Api(value = "app预定", tags = "app预定")
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/bookingApp")
public class BookingAppController {
    private final IBookingService service;
    /**近期联系记录 最近一次预定/沟通记录*/
    @GetMapping("pageList")
    public ResultData pageList(QueryBookingModel model){
        return service.pageList(model);
    }

    /**新增预定*/
    @PostMapping("add")
    public ResultData add(@Valid @RequestBody AddBookingModel model){
        return service.add(model);
    }
    /**新增跟进记录*/
    @PostMapping("addBookNote")
    public ResultData addBookNote(@Valid @RequestBody AddBooknoteModel model){
        return service.addBookNote(model);
    }
    /**修改预定内容*/
    @PostMapping("edit")
    public ResultData edit(@Valid @RequestBody EditBookingModel model){
        return service.edit(model);
    }
    /**修改预定状态*/
    @PostMapping("updateStatus")
    public ResultData updateStatus(@Valid @RequestBody BookingStatusModel model){
        return service.updateStatus(model);
    }
    /**客户跟进记录 查看联系人预定次数统计*/
    @GetMapping("getBooking")
    public ResultData getBooking(GetBookingModel model){
        return service.getBooking(model);
    }
    /**近期联系记录 最近通话用户*/
    @GetMapping("getRecentPhoneRecord")
    public ResultData getRecentPhoneRecord(){
        return service.getRecentPhoneRecord();
    }
    /**近期联系记录 获取所有联系人及预定记录*/
    @PostMapping("getAllLinkman")
    public ResultData getAllLinkman(@Valid @RequestBody List<PhoneRecordModel> phoneList){
        return service.getAllLinkman(phoneList);
    }
    /**获取当天预定的情况*/
    @GetMapping("getTodayBooking")
    public ResultData getTodayBooking(BookingModel model){
        return service.getTodayBooking(model);
    }
    /**根据id查询*/
    @GetMapping("getById")
    public ResultData getById(Long bookingId){
        return service.getBookingById(bookingId);
    }
    /**发送预定短信*/
    @PostMapping("sendSms")
    public ResultData sendSms(@Valid @RequestBody Long bookingId){
        return service.sendSms(bookingId);
    }
}
